/*
 * This file is part of Cadmium.
 * Copyright (C) 2007-2010 Xavier Clerc.
 *
 * Cadmium is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 3 of the License, or
 * (at your option) any later version.
 *
 * Cadmium is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package fr.x9c.cadmium.primitives.unix;

import fr.x9c.cadmium.kernel.CodeRunner;
import fr.x9c.cadmium.kernel.Fail;
import fr.x9c.cadmium.kernel.Primitive;
import fr.x9c.cadmium.kernel.PrimitiveProvider;
import fr.x9c.cadmium.kernel.Value;

/**
 * This class provides implementation for terminal-related primitives.
 *
 * @author <a href="mailto:cadmium@x9c.fr">Xavier Clerc</a>
 * @version 1.0
 * @since 1.0
 */
@PrimitiveProvider
public final class Termios {

    /**
     * No instance of this class.
     */
    private Termios() {
    } // end empty constructor

    /**
     * No implementation of this primitive.
     * @param ctxt context
     * @param fd ignored
     * @return <i>unit</i>
     * @throws Fail.Exception always
     */
    @Primitive
    public static Value unix_tcgetattr(final CodeRunner ctxt,
                                       final Value fd)
        throws Fail.Exception {
        Fail.invalidArgument("Unix.tcgetattr not implemented");
        return Value.UNIT;
    } // end method 'unix_tcgetattr(CodeRunner, Value)'

    /**
     * No implementation of this primitive.
     * @param ctxt context
     * @param fd ignored
     * @param when ignored
     * @param arg ignored
     * @return <i>unit</i>
     * @throws Fail.Exception always
     */
    @Primitive
    public static Value unix_tcsetattr(final CodeRunner ctxt,
                                       final Value fd,
                                       final Value when,
                                       final Value arg)
        throws Fail.Exception {
        Fail.invalidArgument("Unix.tcsetattr not implemented");
        return Value.UNIT; // never reached
    } // end method 'unix_tcsetattr(CodeRunner, Value, Value, Value)'

    /**
     * No implementation of this primitive.
     * @param ctxt context
     * @param fd ignored
     * @param delay ignored
     * @return <i>unit</i>
     * @throws Fail.Exception always
     */
    @Primitive
    public static Value unix_tcsendbreak(final CodeRunner ctxt,
                                         final Value fd,
                                         final Value delay)
        throws Fail.Exception {
        Fail.invalidArgument("Unix.tcsendbreak not implemented");
        return Value.UNIT; // never reached
    } // end method 'unix_tcsendbreak(CodeRunner, Value, Value)'

    /**
     * No implementation of this primitive.
     * @param ctxt context
     * @param fd ignored
     * @return <i>unit</i>
     * @throws Fail.Exception always
     */
    @Primitive
    public static Value unix_tcdrain(final CodeRunner ctxt,
                                     final Value fd)
        throws Fail.Exception {
        Fail.invalidArgument("Unix.tcdrain not implemented");
        return Value.UNIT; // never reached
    } // end method 'unix_tcdrain(CodeRunner, Value)'

    /**
     * No implementation of this primitive.
     * @param ctxt context
     * @param fd ignored
     * @param queue ignored
     * @return <i>unit</i>
     * @throws Fail.Exception always
     */
    @Primitive
    public static Value unix_tcflush(final CodeRunner ctxt,
                                     final Value fd,
                                     final Value queue)
        throws Fail.Exception {
        Fail.invalidArgument("Unix.tcflush not implemented");
        return Value.UNIT; // never reached
    } // end method 'unix_tcflush(CodeRunner, Value, Value)'

    /**
     * No implementation of this primitive.
     * @param ctxt context
     * @param fd ignored
     * @param action ignored
     * @return <i>unit</i>
     * @throws Fail.Exception always
     */
    @Primitive
    public static Value unix_tcflow(final CodeRunner ctxt,
                                    final Value fd,
                                    final Value action)
        throws Fail.Exception {
        Fail.invalidArgument("Unix.tcflow not implemented");
        return Value.UNIT; // never reached
    } // end method 'unix_tcflow(CodeRunner, Value, Value)'

} // end class 'Termios'
